package com.vivianwei.sqlfix;

import cn.hutool.core.collection.CollectionUtil;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description
 * @Author wangwei
 * @Date2021/3/10 11:38 上午
 * @Version V1.0
 **/
public class SqlExecutor {

    private List<SqlProcess> sqlProcessList = new ArrayList<SqlProcess>();

    public void add(SqlProcess process){
        sqlProcessList.add(process);
    }

    public void execute() throws SQLException {
        if (CollectionUtil.isNotEmpty(sqlProcessList)) {
            for (SqlProcess sqlProcess : sqlProcessList) {
                sqlProcess.execute();
            }
        }
    }
}
